﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MoroMoro.Samples.ToDoList.Presentation.Views.Categories
{
    /// <summary>
    /// カテゴリ構築フォームです。
    /// </summary>
    public partial class CategoryBuildForm : BuildForm, ICategoryBuildView
    {
        /// <summary>
        /// <see cref="CategoryBuildForm"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        public CategoryBuildForm()
        {
            InitializeComponent();
        }


        /// <summary>
        /// 名前ラベル。
        /// </summary>
        protected System.Windows.Forms.Label _nameLabel;

        /// <summary>
        /// 名前テキストボックス。
        /// </summary>
        protected System.Windows.Forms.TextBox _nameTextBox;


        /// <inheritdoc/>
        event EventHandler ICategoryBuildView.NameTextChanged
        {
            add
            {
                _nameTextBox.TextChanged += value;
            }
            remove
            {
                _nameTextBox.TextChanged -= value;
            }
        }


        /// <inheritdoc/>
        string ICategoryBuildView.Name
        {
            get
            {
                return _nameTextBox.Text;
            }
            set
            {
                _nameTextBox.Text = value;
            }
        }


        /// <inheritdoc/>
        void ICategoryBuildView.SetNameError(string message)
        {
            _errorProvider.SetError(_nameTextBox, message);
        }
    }
}
